Skip to content

Conversation

@janosh
Copy link
Contributor

@janosh janosh commented Apr 22, 2021

Fixes the following deprecation warning:

/home/jr769/miniconda3/envs/py38/lib/python3.8/site-packages/pymongo/srv_resolver.py:72: DeprecationWarning: please use dns.resolver.resolve() instead
  results = resolver.query('_mongodb._tcp.' + self.__fqdn, 'SRV',
/home/jr769/miniconda3/envs/py38/lib/python3.8/site-packages/pymongo/srv_resolver.py:57: DeprecationWarning: please use dns.resolver.resolve() instead
  results = resolver.query(self.__fqdn, 'TXT',

@janosh
Copy link
Contributor Author

janosh commented Apr 22, 2021

Looks like I'm unable to see the details of why the evergreen test failed without creating an account. 😞

@ShaneHarvey ShaneHarvey changed the title Replace deprecated dns.resolver.query with dns.resolver.resolve PYTHON-2364 Replace deprecated dns.resolver.query with dns.resolver.resolve Apr 22, 2021
Copy link
Member

@ShaneHarvey ShaneHarvey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this on!

from pymongo.srv_resolver import resolver
patched_resolver = FunctionCallRecorder(resolver.query)
pymongo.srv_resolver.resolver.query = patched_resolver
patched_resolver = FunctionCallRecorder(resolver.resolve)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be updated now that we use pymongo.srv_resolver._resolve instead of pymongo.srv_resolver.resolver.resolve.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if I did this correctly.

Copy link
Member

@ShaneHarvey ShaneHarvey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks @janosh!

@ShaneHarvey ShaneHarvey merged commit fac0372 into mongodb:master Apr 23, 2021
ShaneHarvey pushed a commit that referenced this pull request Apr 23, 2021
…esolve (#598)

Fall back to dns.resolver.query for dns v1 compat.

(cherry picked from commit fac0372)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants